1. Field of the Invention
The present invention relates to processing input and output to hardware registers of a computer system, and more particularly to polling device registers in carrying out read and write requests.
2. Background of the Related Art
Memory-mapped input/output (MMIO) is used to perform input/output (I/O) from a central processing unit (CPU) to system memory and hardware registers of peripheral devices over the same bus. The system memory and peripheral devices are each assigned a different address space. Hardware registers on each peripheral device, are mapped to specific addresses within the address space assigned to that peripheral device. In one implementation of MMIO, each peripheral device monitors the CPU's address bus for I/O activity referencing its assigned address space. In another implementation, an MMIO ring comprising an MMIO master and slaves is used to direct I/O traffic between the CPU and the peripheral devices, wherein each slave is responsible for a different subset of device registers. The MMIO master delivers Read/Write (R/W) command packets from the processor bus to the MMIO ring. Each command packet is passed to the MMIO slave that is responsible for the relevant device register. To process a write command, the MMIO slave may take the data from the data packet following the command packet and write the data to the relevant register. To process a read command, the MMIO slave may read the relevant register and put its data in a data packet following the command packet.
Polling is sometimes performed by the CPU to determine when a peripheral device is ready to handle a R/W request. In conventional polling methods, the CPU communicates with the peripheral device over the bus to periodically check the status of the peripheral device, which generates polling traffic on the bus. A mailbox is an example of an application in which polling is used. A mailbox provides a way of communicating between software threads without requiring the use of interrupts. When a thread (the producer) wants to send a message to another thread (the consumer), the producer polls a status bit in the mailbox (a part of system memory) to see if there is a valid buffer for its message. When the status bit indicates that there is an available buffer, the producer writes the message to the mailbox and sets another status bit (the “doorbell ring”) to indicate that a message is ready to be read by the consumer. Likewise, the consumer polls the doorbell ring status bit(s) in order to know when it has an available message to read.